import httpAxios from '../utils/httpAxios'

// 登录
export const login = (name: string, pwd: string, captcha: string) => {
    return httpAxios.post('/login', { name, pwd, captcha })
}

// 注册
export const register = (name: string, pwd: string) => {
    return httpAxios.post('/register', { name, pwd })
}

// 验证码
export const getcaptcha = () => {
    return httpAxios.get('/getcaptcha')
}

// 获取数据
export const getdata = () => {
    return httpAxios.get('/books')
}

// 分页获取数据
export const getdatapage = (data: object) => {
    return httpAxios.post('/books/list', data)
}

// 搜索数据
export const getsearch = (data: object) => {
    return httpAxios.post('/books/search', data)
}

// 新增数据
export const add = (data: object) => {
    return httpAxios.post('/books/add', data)
}

// 修改数据
export const editlist = (data: object) => {
    return httpAxios.post('/books/edit', data)
}

// 删除数据
export const deletelist = (delid: number) => {
    return httpAxios.post('/books/delete', {delid})
}